package com.consult.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.consult.config.dto.AjaxResult;
import com.consult.entity.DutyTimeBucket;
import com.consult.service.IDutyTimeBucketService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-06-26
 */
@RestController
@RequestMapping("/dutyTime")
public class DutyTimeBucketController {

    @Resource
    private IDutyTimeBucketService duTyTimeService;

    @PostMapping("/page")
    public AjaxResult getDutyTimePage(@RequestBody Page<DutyTimeBucket> page) {
        page = duTyTimeService.getDutyTimePage(page);
        return AjaxResult.success(page);
    }

    @PostMapping("/add")
    public AjaxResult addDutyTime(@RequestBody DutyTimeBucket timeBucket) {
        duTyTimeService.save(timeBucket);
        return AjaxResult.success();
    }

    @PostMapping("/update")
    public AjaxResult updateDutyTime(@RequestBody DutyTimeBucket timeBucket) {
        duTyTimeService.updateById(timeBucket);
        return AjaxResult.success();
    }

}

